<% if(!_.isEmpty(activity) && activity != null){ %> 
<% 
	var cardLink = '<a href="#/board/' + activity.attributes.board_id + '/card/' + activity.attributes.card_id + '">' + (activity.attributes.card_name) + '</a>';
	var organizationLink = '<a href="#/organization/' + activity.attributes.organization_id + '">' + (activity.attributes.organization_name) + '</a>';
	if(activity.attributes.type != 'add_comment' && activity.attributes.type != 'edit_comment') {
		activity.attributes.comment = activity.attributes.comment.replace('##ORGANIZATION_LINK##', organizationLink);
		activity.attributes.comment = activity.attributes.comment.replace('##CARD_LINK##', cardLink);
		activity.attributes.comment = activity.attributes.comment.replace('##LABEL_NAME##', (activity.attributes.label_name));
		activity.attributes.comment = activity.attributes.comment.replace('##CARD_NAME##', (activity.attributes.card_name));
		activity.attributes.comment = activity.attributes.comment.replace('##DESCRIPTION##', (activity.attributes.card_description));
		activity.attributes.comment = activity.attributes.comment.replace('##LIST_NAME##', (activity.attributes.list_name));
		activity.attributes.comment = activity.attributes.comment.replace('##BOARD_NAME##', (activity.attributes.board_name));
		activity.attributes.comment = activity.attributes.comment.replace('##USER_NAME##', '<span class="h5">'+_.escape(activity.attributes.full_name)+'</span>');
		activity.attributes.comment = activity.attributes.comment.replace('##CHECKLIST_ITEM_NAME##', (activity.attributes.checklist_item_name));
		activity.attributes.comment = activity.attributes.comment.replace('##CHECKLIST_ITEM_PARENT_NAME##', (activity.attributes.checklist_item_parent_name));
		activity.attributes.comment = activity.attributes.comment.replace('##CHECKLIST_NAME##', (activity.attributes.checklist_name));
	} else {
		var comment = filterXSS(activity.attributes.full_name) + ' commented in card ' + cardLink;
		var matches = activity.attributes.comment.match(/@([^ ]*)/g);
		var _username = [];
		_.each(matches, function(match) {
			_username.push(match.substr(1));
		});
		if(_.contains(_username, authuser.user.username)){
			comment = filterXSS(activity.attributes.full_name) + ' has mentioned you in card ' + cardLink;
		}
	}
%>
<div class="media">
	<a data-placement="bottom" title="<%-activity.attributes.full_name %> (<%-activity.attributes.username %>)" data-toggle="tooltip" class="js-tooltip pull-left" href="#/user/<%- activity.attributes.user_id %>">
		<% if(!_.isEmpty(activity.attributes.profile_picture_path)) {
			var profile_picture_path = activity.showImage('User', activity.attributes.user_id, 'small_thumb' );
		%>
			<img src="<%=profile_picture_path %>" alt="[Image: <%-activity.attributes.full_name %>]" title="<%-activity.attributes.full_name %> (<%-activity.attributes.username %>)" class="img-rounded img-responsive avatar">
		<% } else {%> 
			<i class="avatar avatar-color-194 img-rounded"><%- activity.attributes.initials %></i>
		<% } %>
	</a>
	<div class="media-body"> <!-- Condition for comment activities design -->
    	<% if(activity.attributes.type != 'add_comment' && activity.attributes.type != 'add_card_duedate') { %>
		<div class="media-heading">			
            <span class="js-activity-<%- activity.attributes.id %>">
				<% if(activity.attributes.type == 'add_comment' || activity.attributes.type == 'edit_comment') { %>	
					<span><%= comment %></span>
					<%= makeLink(converter.makeHtml((activity.attributes.comment)), activity.attributes.board_id) %>
				<% } else{%>
					<%= makeLink(converter.makeHtml(activity.attributes.comment), activity.attributes.board_id) %> 
				<% } %>
			</span>
			<% if(activity.attributes.difference != null && _.contains(['edit_comment', 'edit_list', 'edit_organization', 'edit_board', 'update_card_checklist', 'update_profile', 'edit_card', 'delete_card_comment', 'edit_list_color', 'delete_list_color', 'edit_card_desc'], activity.attributes.type)) { %>
                <div class="thumbnail media-body no-mar">
					<% _.each(activity.attributes.difference, function(difference) { %>
						<%= converter.makeHtml(difference) %>
					<% }); %>
				</div>
            <% } %>
		</div>   
        <% } else {%>             
		<div class="col-xs-12 row">
			<div class="panel no-mar">
				<div class="panel-body">
					<span class="js-activity-<%- activity.attributes.id %>">
						<% if(activity.attributes.type == 'add_comment' || activity.attributes.type == 'edit_comment') { %>	
							<span><%= comment %></span>
							<%= makeLink(converter.makeHtml((activity.attributes.comment)), activity.attributes.board_id) %>
						<% } else{%>
							<%= makeLink(converter.makeHtml(activity.attributes.comment), activity.attributes.board_id) %> 
						<% } %>
					</span>
					<% if(activity.attributes.difference != null && _.contains(['edit_comment', 'edit_list', 'edit_organization', 'edit_board', 'update_card_checklist', 'update_profile', 'edit_card', 'edit_list_color', 'delete_list_color', 'edit_card_color', 'delete_card_color'], activity.attributes.type)) { %>
						<div class="thumbnail media-body no-mar"><%= converter.makeHtml(activity.attributes.difference[0]) %></div>
					<% } %>
					
				</div>
			</div>		
		</div>
        <% } %>
	</div>
</div>
<div class="clearfix col-xs-12">
	<div class="clearfix col-xs-12">
		<small class="col-xs-12 pull-left">
			&nbsp;&nbsp;
			<% setInterval(function() {%>
				<% parse_date(activity.attributes.created, authuser,'js-timeago-'+activity.attributes.id); %>
			<% }, 10000); %>
			<span class="js-timeago-<%- activity.attributes.id %>"></span>
			<% parse_date(activity.attributes.created, authuser,'js-timeago-'+activity.attributes.id); %>
			<% if((activity.attributes.type == 'add_organization_attachment' || activity.attributes.type == 'change_visibility' || activity.attributes.type == 'add_organization_user' || activity.attributes.type == 'delete_organization_user') && (!_.isEmpty(activity.attributes.organization_name))) { %>
				<a class="pull-left" href="#/organization/<%= activity.attributes.organization_id %>">&nbsp;<%- i18next.t('on') %>&nbsp;<%- activity.attributes.organization_name %></a>
			<% } else if((type == 'all' && activity.attributes.type != 'update_profile' && activity.attributes.type != 'edit_organization' && activity.attributes.type != 'add_organization') && (!_.isEmpty(activity.attributes.board_name))) { %>
				<a class="pull-left" href="#/board/<%= activity.attributes.board_id %>">&nbsp;<%- i18next.t('on') %>&nbsp;<%- activity.attributes.board_name %></a>
			<% } %>
					<% if(!_.isUndefined(authuser.user) && activity.attributes.type == "add_comment" && type != "all") { %>    
						<div class="js-acticity-action-<%- activity.attributes.id %> pull-left">
							<ul class="list-inline col-xs-offset-0">
							<% if(!_.isEmpty(role_links.where({slug: "edit_comment"}))){ %>
								<li><a title="<%- i18next.t('Edit') %>" class="js-show-edit-activity js-edit-activity-link-<%- activity.attributes.id %>" href="#" data-activity-id="<%- activity.attributes.id %>"><i class="icon-edit"></i><%- i18next.t("Edit") %></a></li>
							<% } %> 
								<li><a title="<%- i18next.t('Reply') %>" class="js-show-reply-activity-form js-reply-activity-link-<%- activity.attributes.id %>" href="#" data-activity-id="<%- activity.attributes.id %>"><i class="icon-repeat"></i><%- i18next.t("Reply") %></a></li>
							<% if(!_.isEmpty(role_links.where({slug: "delete_comment"}))){ %>								
									<li class="dropdown">   
										<a title="<%- i18next.t('Delete') %>" class="dropdown-toggle js-show-confirm-comment-delete" data-toggle="dropdown" href="#" data-activity-id="<%- activity.attributes.id %>"><i class="icon-remove"></i><%- i18next.t("Delete") %></a>
										<ul class="dropdown-menu arrow arrow-right">
											<li id="js-acticity-actions-response-<%- activity.attributes.id %>" class="js-dropdown-popup dropdown-popup"></li>
										</ul>
									</li>
								
							<% } %>
							</ul>
						</div>
					<% } else if(activity.attributes.revisions != null && activity.attributes.revisions != "" && (parseInt(authuser.user.id) == 1)){ %>
						<% if(!_.isEmpty(role_links.where({slug: "undo_activity"}))){ %>
							<% if(_.isUndefined(activity.from_footer)) { %>
								<div class="pull-left js-acticity-action-<%- activity.attributes.id %>"><ul class="list-inline col-xs-offset-0"><li><a title="<%- i18next.t('Undo') %>" class="js-undo2 pull-left" href="#" data-activity-id="<%- activity.attributes.id %>"><i class="icon-undo"></i><%- i18next.t("Undo") %></a></li></ul></div>
							<% }%>	
						<% } %>
					<% } %>
					<span class="pull-left col-xs-12 js-activity-reply-form-response-<%- activity.attributes.id %>"></span>
		</small>
	</div>
</div>
<hr class="clearfix col-xs-12 btn-block"/>
<% }else{ %><div class="media-body alert alert-info"><%- i18next.t('No %s available.', { postProcess: 'sprintf', sprintf: [i18next.t('activities')] }) %></div><% } %>
